package com.example.tests;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import org.testng.annotations.Test;

import com.example.fw.ContactObject;
import com.example.fw.Contacts;


public class ContactModificationTests extends TestBase {
 
	@Test(dataProvider = "randomContactObject", dataProviderClass = ContactDataGenerator.class)
	public void modificatedContactWithAllData(ContactObject newContact) throws Exception {
		Contacts oldList = app.getContactHelper().getContacts();
		ContactObject oldContact = oldList.getSomeContact();	
		//ContactObject oldContact = app.getContactHelper().getContactByNumber(0);
		app.getContactHelper().modifyContact(oldContact, newContact);
		Contacts newList = app.getContactHelper().getContacts();
		assertThat(newList, equalTo(oldList.without(oldContact).withAdded(newContact)));
	}
}
